﻿Public Class frnCarnetCliente 
    Public Sub Mostrar()
        If guardar.Enabled = False Then
            guardar.Enabled = True
            cancelar.Enabled = True
            agregar.Enabled = False
            modificar.Enabled = False
            eliminar.Enabled = False
            imprimir.Enabled = False
            PanelArriba.Enabled = True
            PanelAbajo.Enabled = False
        Else
            cancelar.Enabled = False
            guardar.Enabled = False
            agregar.Enabled = True
            Modificar.Enabled = True
            Eliminar.Enabled = True
            imprimir.Enabled = True
            PanelArriba.Enabled = False
            PanelAbajo.Enabled = True

        End If
    End Sub
    Private Sub CarnetclienteBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CarnetclienteBindingNavigatorSaveItem.Click
        Me.Validate()
        Me.CarnetclienteBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.DbFireAndIceDataSet)

    End Sub

    Private Sub frnCarnetCliente_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'DbFireAndIceDataSet.carnetempleado' table. You can move, or remove it, as needed.
        Me.CarnetempleadoTableAdapter.Fill(Me.DbFireAndIceDataSet.carnetempleado)
        'TODO: This line of code loads data into the 'DbFireAndIceDataSet.clientes' table. You can move, or remove it, as needed.
        Me.ClientesTableAdapter.Fill(Me.DbFireAndIceDataSet.clientes)
        'TODO: This line of code loads data into the 'DbFireAndIceDataSet.carnetcliente' table. You can move, or remove it, as needed.
        Me.CarnetclienteTableAdapter.Fill(Me.DbFireAndIceDataSet.carnetcliente)

    End Sub


    Private Sub GroupControl1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles GroupControl1.Paint

    End Sub

    Private Sub IdclienteLookUpEdit_EditValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles IdclienteLookUpEdit.EditValueChanged

    End Sub

    Private Sub guardar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles guardar.Click

    End Sub

    Private Sub eliminar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles eliminar.Click
        Dim opcion As Integer
        opcion = MsgBox("¿Está seguro que desea eliminar el registro?", MsgBoxStyle.YesNo + MsgBoxStyle.Question, "Eliminar registro")
        If opcion = vbYes Then
            Try
                'CarnetclienteTableAdapter.DeleteQuery(IdclienteLookUpEdit.Text)
                Me.CarnetclienteTableAdapter.Fill(Me.DbFireAndIceDataSet.carnetcliente)
            Catch ex As Exception
                MsgBox("Lo sentimos, el registro no puede ser eliminado ya que está relacionado con otras tablas", MsgBoxStyle.Critical, "Error")
            End Try


        End If
    End Sub
End Class